package com.codeiy.util;

import cn.dev33.satoken.stp.StpUtil;

import static com.codeiy.constant.CommonConstants.TENANT_ID;
import static com.codeiy.constant.CommonConstants.USERNAME;

public class AuthUtils {
    public static Long getTenantId() {
        if (!StpUtil.isLogin()) {
            return null;
        }
        return (Long) StpUtil.getExtra(TENANT_ID);
    }

    public static String getUsername() {
        if (!StpUtil.isLogin()) {
            return null;
        }
        return (String) StpUtil.getExtra(USERNAME);
    }
}
